package com.example.springcloudssoclientserver.contorller;

import org.apache.tomcat.util.http.parser.Authorization;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@RequestMapping(value = "/order")
public class OrderController {

    @GetMapping(value = "/principal",produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Principal> getPrincipal(Principal principal){
        return ResponseEntity.ok(principal);
    }

    @GetMapping(value = "/authentication",produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Authentication> getAuthorization(Authentication authentication){
        return ResponseEntity.ok(authentication);
    }
}
